<!DOCTYPE html>
<html>
<head lang="zh-CN">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="address=no">
    <script type="text/javascript" src="//3gimg.qq.com/lightmap/components/locationPicker2/js/main-62c2e3b971.js"></script>
    <title>选择地址</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body, html{
            overflow: hidden;
        }
    </style>
    <script>
        //iframe页面调用方法
        $(function(){

            adaptHeight();//动态适配高度

            window.onresize = function() { //横屏、QQ浏览器变全屏模式下的时候，需要重新计算高度
                adaptHeight();
            }

            window.addEventListener('message', function(event) {
                var loc = event.data;
                //alert('你使用的组件是'+loc.module+',刚选择了'+loc.poiname+',它位于'+loc.poiaddress+',它的经纬度是：'+loc.latlng.lat+','+loc.latlng.lng+',所属城市为:'+loc.cityname)
                $.getJSON("{:url('index/cart/changecookie')}", {name: 'poiname', 'val': loc.poiname}, function(json, textStatus) {});
                $.getJSON("{:url('index/cart/changecookie')}", {name: 'poiaddress', 'val': loc.poiaddress}, function(json, textStatus) {});
                $.getJSON("{:url('index/cart/changecookie')}", {name: 'latlng', 'val': loc.latlng.lat+','+loc.latlng.lng}, function(json, textStatus) {});

                setTimeout(function() {
                    javascript:history.go(-1)
                }, 1000);

            }, false);

            function adaptHeight() {
                var winH = $(window).height();
                var bodyH = document.documentElement.clientHeight;
                if (winH > bodyH) {
                    window.parent.document.getElementById("iframe").height=winH;
                } else {
                    window.parent.document.getElementById("iframe").height=bodyH;
                }
            }
        });
    </script>
</head>
<body>

    <div id="map">
      <!-- 通过 iframe 嵌入地图选点组件 -->
      <iframe id="iframe" width="100%" frameborder=0 scrolling="no"
          src="http://apis.map.qq.com/tools/locpicker?search=1&type=1&policy=1&key=QQ6BZ-24HC6-ZAXSZ-MTZAU-5MU2J-HEFEH&referer=鲜果屋&coord={$Think.cookie.positioninit}">
      </iframe>
    </div>


</body>
